<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="apple-touch-fullscreen" content="yes">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="format-detection" content="telephone=no">

        <title>轩盛商品方案</title>

        <link href="__CSS__/index.css" rel="stylesheet">


        <link href="__CSS__/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
        <link href="__CSS__/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
        <link href="__CSS__/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
        <link href="__CSS__/animate.min.css" rel="stylesheet">
        <link href="__CSS__/style.min862f.css?v=4.1.0" rel="stylesheet">
        <link href="__JS__/layui/css/layui.css"rel="stylesheet">
        
        <style>
         .table {table-layout:fixed;}

         table td{border:2px solid #000!important}
          table th{border:2px solid #000!important}

        </style>

    </head>
    <body>

<div id="export_word">

        <div style="height: 50px;"></div>

        <div id="scheme_name" class="text-center">
            <p style="font-size: 30px">轩盛后台</p>
        </div>

         <div style="height: 20px;"></div>

    <div class="container">

      <div id="Template">

        <div class="table-responsive">

          <table class="table table-hover table-bordered table-striped">
           <tr>
                  <thead id="finalhead">
                     <tr>
                          <th class="tablefinal">
                            <div>金融代码</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款方式</div>
                          </th>
                          <th class="tablefinal">
                            <div>放款时间</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款金额</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款期限</div>
                          </th>
                          <th class="tablefinal">
                            <div>综合月利息</div>
                          </th>
                          <th class="tablefinal">
                            <div>一次性平台费/保险费</div>
                          </th>
                          <th class="tablefinal">
                            <div>后期还贷利息</div>
                          </th>
                          <th class="tablefinal">
                            <div>还款方式</div>
                          </th>
                          <th class="tablefinal">
                            <div>每月还款</div>
                          </th>
                          <th class="tablefinal">
                            <div>征信次数</div>
                          </th>
                          <th class="tablefinal" style="width:200px;" >
                            <div>征信显示</div>
                          </th>
                          <th class="tablefinal printPage">
                            <div>操作</div>
                          </th>
                        </tr>
                  </thead>

             

                  <tbody id="finaltbody" class="finaltbody">
                    <tr>
                     <td class="text-center" id="Financialcode">正在加载</td>
                     <td class="text-center" id="Loanmethod">正在加载</td>
                     <td class="text-center" id="Lendingtime">正在加载</td>
                     <td class="text-center" id="Amountofloan">正在加载</td>
                     <td class="text-center" id="Loanterm">正在加载</td>
                     <td class="text-center" id="Comprehensive">正在加载</td>
                     <td class="text-center" id="Disposable">正在加载</td>
                     <td class="text-center" id="Later">正在加载</td>
                     <td class="text-center" id="Repaymentmethod">正在加载</td>
                     <td class="text-center" id="Monthlyrepayment">正在加载</td>
                     <td class="text-center" id="Bond">正在加载</td>
                     <td class="text-center" id="credit_investigation">正在加载</td>
                     <td class="text-center" id="credit">正在加载</td>
                     <td class="text-center printPage"><input type="button" style="width: 40px; height:34px; padding:0;" value="编辑">
                     <button class="btn btn-danger classifyRemove"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                 </td>
                    </tr>

                  </tbody>
               
           </tr>
          </table>


        </div>
            

            <div class="cause">

                <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                
                    <div style="height: 5px;"></div>

                <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; " class="form-control" rows="8">一切方案尽以征信、保单网核过关为准</textarea>

                <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>

                <div style="height: 20px;"></div>

            
    
              <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>

                <textarea  name="loan_multiples_requirements" style="resize:none" class="form-control" rows="8">正在加载</textarea>
                

            </div>

        <div style="height: 50px;"></div>

        <!-- 浓缩表 -->
         <div class="table-responsive">

          <table class="table table-hover table-bordered table-striped">
           <tr>
                  <thead id="Concentratefinalhead">
                        <tr>
                          <th class="tablefinal">
                            <div>金融代码</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款方式</div>
                          </th>
                          <th class="tablefinal">
                            <div>放款时间</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款金额</div>
                          </th>
                          <th class="tablefinal">
                            <div>贷款期限</div>
                          </th>
                          <th class="tablefinal">
                            <div>综合月利息</div>
                          </th>
                          <th class="tablefinal">
                            <div>一次性平台费/保险费</div>
                          </th>
                          <th class="tablefinal">
                            <div>后期还贷利息</div>
                          </th>
                          <th class="tablefinal">
                            <div>还款方式</div>
                          </th>
                          <th class="tablefinal">
                            <div>每月还款</div>
                          </th>
                        </tr>
                  </thead>

             

                  <tbody id="Concentratefinaltbody">
                    <tr>
                     <td class="text-center" id="Financialcode">正在加载</td>
                     <td class="text-center" id="Loanmethod">正在加载</td>
                     <td class="text-center" id="Lendingtime">正在加载</td>
                     <td class="text-center" id="Amountofloan">正在加载</td>
                     <td class="text-center" id="Loanterm">正在加载</td>
                     <td class="text-center" id="Comprehensive">正在加载</td>
                     <td class="text-center" id="Disposable">正在加载</td>
                     <td class="text-center" id="Later">正在加载</td>
                     <td class="text-center" id="Repaymentmethod">正在加载</td>
                     <td class="text-center" id="Monthlyrepayment">正在加载</td>
                    </tr>

                  </tbody>
               
           </tr>
          </table>


        </div>
            

            <div id="cause">

                <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                
                    <div style="height: 5px;"></div>

                <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; " class="form-control" rows="8">一切方案尽以征信、保单网核过关为准</textarea>

                <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>

                <div style="height: 20px;"></div>

            
    
              <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>

                <textarea  name="loan_multiples_requirements" style="resize:none" class="form-control" rows="8">正在加载</textarea>
                

            </div>

        <div style="height: 50px;"></div>

      </div>

    </div>

 </div>
  
      

        <div class="form-group">

            <div class="col-sm-2 col-sm-offset-5">
                <button lay-submit lay-filter ="upload" onclick="Reselection()" style="width: 150px;" class="btn btn-primary btn-block printPage" >重新挑选</button>
            </div>

     <!--        <div class="col-sm-2 col-sm-offset-1">
                <button lay-submit lay-filter ="upload" onclick="final_Submission()"  style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
            </div>

            <div class="col-sm-2 col-sm-offset-2">
                <code class="language-html"><a href="javascript:void(0)" class="btn btn-primary printPage" onclick="exportWord()">导出</a></code> 
            </div> -->
        </div>
        
        
        <div style="height: 100px;"></div>
 
        <!-- <script src="__JS__/screeningjs/jquery-1.4.3.min.js"></script>  -->

         <script src="__JS__/jquery.min.js?v=2.1.4"></script>

        <script src="__JS__/FileSaver.js"></script>
        <script src="__JS__/jquery.wordexport.js"></script>

        <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
        <script src="__JS__/content.min.js?v=1.0.0"></script>

        <script src="__JS__/layui/layui.js"></script> 

      

        <script type="text/javascript">

             // 全局变量
             g_name="";

             var versions = "";


           // 引用layui
        layui.use(['layer', 'form'], function(){
          var layer = layui.layer;
          var form = layui.form;
        });

    

            // 加载初始数据
           $(function(){

            $.ajax({

                type:"post",

                url:"ajaxScme",

                 data:'order_sn='+result,
                success:function(data){



                    console.log(data);

                    var switch1 = 1;

                    var html = "";

                    var html2 = "";

                    var html3 = "";

                    var htmla = "";

                    var synthesize = "";

                    var refund = "";
                    // 综合月利息
                    var a=0; 

                    var b=0;

                    var c=0;

                    // 每月还款

                    var d=0; 


                    // 取后三位

                    var synthe=0;

                    var refundnum=0;
                    // 后台传过来的是 对象字符串

                        // 将字符串 转成 Json对象

                    // var jsonObj = $.parseJSON(data);

                    // 遍历Json对象

                    $.each(data,function(i,v){

                    console.log(i);
                    console.log(v);

                    versions = v[0].versions;

                if (v[0].type == 1) {

                    html+=`

                  <div class="text-center">
                        <p style="font-size: 30px">${v[0].scheme_name}</p>
                        <p style="font-size: 24px">第${v[0].versions}方案表</p>
                    </div>
                    
                    <div style="height: 50px;"></div>

                    <div class="table-responsive">

                      <table class="table table-hover table-bordered table-striped">
                       <tr>
                              <thead id="finalhead">
                                 <tr>
                                 <th class="tablefinal printPage" style="width:150px;">
                                        <div>操作</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>金融代码</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>放款时间</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款金额</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款期限</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>综合月利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>一次性平台费/保险费</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>后期还贷利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>还款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>每月还款</div>
                                      </th>
                                      <th class="tablefinal printPage" style="width: 500px;">
                                        <div>征信次数</div>
                                      </th>
                                      <th class="tablefinal printPage" style="width:200px;" >
                                        <div>征信显示</div>
                                      </th>
                                      <th class="tablefinal">
                                            <div>保证金及手续费</div>
                                      </th>
                                      
                                    </tr>
                              </thead>

                         

                              <tbody id="finaltbody" class="finaltbody${i}">
                                <tr>
                                 <td class="text-center" id="Financialcode">正在加载</td>
                                 <td class="text-center" id="Loanmethod">正在加载</td>
                                 <td class="text-center" id="Lendingtime">正在加载</td>
                                 <td class="text-center" id="Amountofloan">正在加载</td>
                                 <td class="text-center" id="Loanterm">正在加载</td>
                                 <td class="text-center" id="Comprehensive">正在加载</td>
                                 <td class="text-center" id="Disposable">正在加载</td>
                                 <td class="text-center" id="Later">正在加载</td>
                                 <td class="text-center" id="Repaymentmethod">正在加载</td>
                                 <td class="text-center" id="Monthlyrepayment">正在加载</td>
                                 <td class="text-center" id="Bond">正在加载</td>
                                 <td class="text-center" id="credit_investigation">正在加载</td>
                                 <td class="text-center" id="credit">正在加载</td>
                                 <td class="text-center printPage"><input type="button" style="width: 40px; height:34px; padding:0;" value="编辑">
                                 <button class="btn btn-danger classifyRemove"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                             </td>
                                </tr>

                              </tbody>
                           
                       </tr>
                      </table>


                    </div>
                        

                        <div id="cause" >

                            <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                            
                                <div style="height: 5px;"></div>

                            <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; font-weight: bold;" class="form-control ready${i}" rows="8">${v[0].remark}</textarea>
                            
                            <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>

                            <div style="height: 20px;"></div>
                            
                            <p style="float: right;">${v[0].date}</p>

                            <div style="height: 20px;"></div>

                        
                
                          <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>
                            <div class="">
                            <textarea  name="loan_multiples_requirements" style="resize:none; font-weight: bold;" class="form-control cause${i} " rows="8">正在加载</textarea>
                            </div>

                        </div>

                        <div style="height: 10px;"></div>
                        
                        <div class="form-group">

                        <div class="col-sm-2 col-sm-offset-3">
                                <button lay-submit lay-filter ="upload" onclick="Printing(this)" data-concentration="${v[0].concentration}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
                            </div>

                            <div class="col-sm-2 col-sm-offset-2">
                                <button lay-submit lay-filter ="upload" onclick="final_Submission(this)" data-ready="${i}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >保存修改</button>
                            </div>

                            
                        </div>

                    <div style="height: 50px;"></div>
                    


                     

                       

                    `
                }else if (v[0].type == 2) {

                html+=`

                    <div class="text-center">
                        <p style="font-size: 30px">${v[0].scheme_name}</p>
                        <p style="font-size: 24px">第${v[0].versions}方案表</p>
                    </div>
                    
                    <div style="height: 50px;"></div>

                
                    <div class="table-responsive">

                      <table class="table table-hover table-bordered table-striped">
                       <tr>
                              <thead id="finalhead">
                                 <tr>
                                 <th class="tablefinal printPage" style="width:150px;">
                                        <div>操作</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>金融代码</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>放款时间</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款金额</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款期限</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>综合月利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>一次性平台费/保险费</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>后期还贷利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>还款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>每月还款</div>
                                      </th>
                                      <th class="tablefinal printPage" style="width: 500px;">
                                        <div>征信次数</div>
                                      </th>
                                      <th class="tablefinal printPage" style="width:200px;" >
                                        <div>征信显示</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>保证金及手续费</div>
                                      </th>
                                      
                                    </tr>
                              </thead>

                         

                              <tbody id="finaltbody" class="finaltbody${i}">
                                <tr>
                                 <td class="text-center" id="Financialcode">正在加载</td>
                                 <td class="text-center" id="Loanmethod">正在加载</td>
                                 <td class="text-center" id="Lendingtime">正在加载</td>
                                 <td class="text-center" id="Amountofloan">正在加载</td>
                                 <td class="text-center" id="Loanterm">正在加载</td>
                                 <td class="text-center" id="Comprehensive">正在加载</td>
                                 <td class="text-center" id="Disposable">正在加载</td>
                                 <td class="text-center" id="Later">正在加载</td>
                                 <td class="text-center" id="Repaymentmethod">正在加载</td>
                                 <td class="text-center" id="Monthlyrepayment">正在加载</td>
                                 <td class="text-center" id="Bond">正在加载</td>
                                 <td class="text-center" id="credit_investigation">正在加载</td>
                                 <td class="text-center" id="credit">正在加载</td>
                                 <td class="text-center printPage"><input type="button" style="width: 40px; height:34px; padding:0;" value="编辑">
                                 <button class="btn btn-danger classifyRemove"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                             </td>
                                </tr>

                              </tbody>
                           
                       </tr>
                      </table>


                    </div>
                        

                        <div id="cause" >

                            <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                            
                                <div style="height: 5px;"></div>

                            <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; font-weight: bold;" class="form-control ready${i}" rows="8">${v[0].remark}</textarea>

                            <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>

                            <div style="height: 20px;"></div>
                            
                            <p style="float: right;">${v[0].date}</p>

                            <div style="height: 20px;"></div>

                        
                
                          <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>
                            <div class="">
                            <textarea  name="loan_multiples_requirements" style="resize:none; font-weight: bold;" class="form-control cause${i}" rows="8">正在加载</textarea>
                            </div>

                        </div>

                               <div style="height: 10px;"></div>
                        
                        <div class="form-group">

                        <div class="col-sm-2 col-sm-offset-3">
                                <button lay-submit lay-filter ="upload" onclick="Printing(this)" data-concentration="${v[0].concentration}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
                            </div>

                            <div class="col-sm-2 col-sm-offset-2">
                                <button lay-submit lay-filter ="upload" onclick="final_Submission(this)" data-ready="${i}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >保存修改</button>
                            </div>

                            
                        </div>
                        

                    <div style="height: 50px;"></div>
                    

                       

                    `
                    // 抵押
                }else if (v[0].type == 3) {

                    html+=`

                    <div class="text-center">
                        <p style="font-size: 30px">${v[0].scheme_name}</p>
                        <p style="font-size: 24px">第${v[0].versions}方案表</p>
                    </div>
                    
                    <div style="height: 50px;"></div>

                    <div class="table-responsive">

                      <table class="table table-hover table-bordered table-striped">
                       <tr>
                              <thead id="finalhead">
                                 <tr>

                                 <th class="tablefinal printPage" style="width:150px;">
                                        <div>操作</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>金融代码</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>放款时间</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款金额</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>贷款期限</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>综合月利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>一次性平台费/保险费</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>后期还贷利息</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>还款方式</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>每月还款</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>费用</div>
                                      </th>
                                      <th class="tablefinal" style="width:200px;" >
                                        <div>备注</div>
                                      </th>
                                      <th class="tablefinal">
                                        <div>保证金及手续费</div>
                                      </th>
                                      
                                    </tr>
                              </thead>

                         

                              <tbody id="finaltbody" class="finaltbody${i}">
                                <tr>
                                 <td class="text-center" id="Financialcode">正在加载</td>
                                 <td class="text-center" id="Loanmethod">正在加载</td>
                                 <td class="text-center" id="Lendingtime">正在加载</td>
                                 <td class="text-center" id="Amountofloan">正在加载</td>
                                 <td class="text-center" id="Loanterm">正在加载</td>
                                 <td class="text-center" id="Comprehensive">正在加载</td>
                                 <td class="text-center" id="Disposable">正在加载</td>
                                 <td class="text-center" id="Later">正在加载</td>
                                 <td class="text-center" id="Repaymentmethod">正在加载</td>
                                 <td class="text-center" id="Monthlyrepayment">正在加载</td>
                                 <td class="text-center" id="Bond">正在加载</td>
                                 <td class="text-center" id="credit_investigation">正在加载</td>
                                 <td class="text-center printPage"><input type="button" style="width: 40px; height:34px; padding:0;" value="编辑">
                                 <button class="btn btn-danger classifyRemove"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                             </td>
                                </tr>

                              </tbody>
                           
                       </tr>
                      </table>


                    </div>
                        

                        <div id="cause" >

                            <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                            
                                <div style="height: 5px;"></div>

                            <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; font-weight: bold;" class="form-control ready${i}" rows="8">${v[0].remark}</textarea>

                            <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>
                            
                            <div style="height: 20px;"></div>

                            <p style="float: right;">${v[0].date}</p>

                            <div style="height: 20px;"></div>

                        
                
                          <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>
                            <div class="">
                            <textarea  name="loan_multiples_requirements" style="resize:none; font-weight: bold;" class="form-control cause${i} " rows="8">正在加载</textarea>
                            </div>

                        </div>

                               <div style="height: 10px;"></div>
                        
                        <div class="form-group">

                        <div class="col-sm-2 col-sm-offset-3">
                                <button lay-submit lay-filter ="upload" onclick="Printing(this)" data-concentration="${v[0].concentration}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
                            </div>

                            <div class="col-sm-2 col-sm-offset-2">
                                <button lay-submit lay-filter ="upload" onclick="final_Submission(this)" data-ready="${i}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >保存修改</button>
                            </div>

                            
                        </div>
                        

                    <div style="height: 50px;"></div>
                    

    
    
                    `
                }else if (v[0].type == 4) {
                    
                    html+=`

                    <div class="text-center">
                        <p style="font-size: 30px">${v[0].scheme_name}</p>
                        <p style="font-size: 24px">第${v[0].versions}方案精简表</p>
                    </div>
                    
                    <div style="height: 50px;"></div>

                    <div class="table-responsive">

                          <table class="table table-hover table-bordered table-striped">
                           <tr>
                                  <thead id="Concentratefinalhead">
                                        <tr>
                                        <th class="tablefinal printPage">
                                            <div>操作</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>金融代码</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款方式</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>放款时间</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款金额</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款期限</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>综合月利息</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>一次性平台费/保险费</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>后期还贷利息</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>还款方式</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>每月还款</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>保证金及手续费</div>
                                          </th>
                                          
                                        </tr>
                                  </thead>

                             

                                  <tbody class="finaltbody${i}">
                                    <tr>
                                     <td class="text-center" id="Financialcode">正在加载</td>
                                     <td class="text-center" id="Loanmethod">正在加载</td>
                                     <td class="text-center" id="Lendingtime">正在加载</td>
                                     <td class="text-center" id="Amountofloan">正在加载</td>
                                     <td class="text-center" id="Loanterm">正在加载</td>
                                     <td class="text-center" id="Comprehensive">正在加载</td>
                                     <td class="text-center" id="Disposable">正在加载</td>
                                     <td class="text-center" id="Later">正在加载</td>
                                     <td class="text-center" id="Repaymentmethod">正在加载</td>
                                     <td class="text-center" id="Monthlyrepayment">正在加载</td>
                                    </tr>

                                  </tbody>
                               
                           </tr>
                          </table>


                        </div>
                            

                            <div id="cause" >

                                <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                                
                                    <div style="height: 5px;"></div>

                                <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; font-weight: bold;" class="form-control" rows="8">${v[0].remark}</textarea>

                                <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>
                                
                                <div style="height: 20px;"></div>
                            
                                 <p style="float: right;">${v[0].date}</p>

                                <div style="height: 20px;"></div>

                            
                    
                              <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>
                            <div class="">
                                 <textarea  name="loan_multiples_requirements" style="resize:none; font-weight: bold;" class="form-control cause${i} " rows="8">正在加载</textarea>
                                </div>

                            </div>

                            <div style="height: 10px;"></div>
                        
                        <div class="form-group">

                        <div class="col-sm-2 col-sm-offset-5">
                                <button lay-submit lay-filter ="upload" onclick="Printing(this)" data-concentration="${v[0].concentration}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
                            </div>

                            
                        </div>

                        <div style="height: 50px;"></div>


    
    
                    `
                }else if (v[0].type == 5) {

                    html+=`

                    <div class="text-center">
                        <p style="font-size: 30px">${v[0].scheme_name}</p>
                        <p style="font-size: 24px">第${v[0].versions}方案精简表</p>
                    </div>
                    
                    <div style="height: 50px;"></div>

                 <div class="table-responsive">

                          <table class="table table-hover table-bordered table-striped">
                           <tr>
                                  <thead id="Concentratefinalhead">
                                        <tr>
                                        <th class="tablefinal printPage">
                                            <div>操作</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>金融代码</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款方式</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>放款时间</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款金额</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>贷款期限</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>综合月利息</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>一次性平台费/保险费</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>后期还贷利息</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>还款方式</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>每月还款</div>
                                          </th>
                                          <th class="tablefinal">
                                            <div>保证金及手续费</div>
                                          </th>
                                          
                                        </tr>
                                  </thead>

                             

                                  <tbody class="finaltbody${i}">
                                    <tr>
                                     <td class="text-center" id="Financialcode">正在加载</td>
                                     <td class="text-center" id="Loanmethod">正在加载</td>
                                     <td class="text-center" id="Lendingtime">正在加载</td>
                                     <td class="text-center" id="Amountofloan">正在加载</td>
                                     <td class="text-center" id="Loanterm">正在加载</td>
                                     <td class="text-center" id="Comprehensive">正在加载</td>
                                     <td class="text-center" id="Disposable">正在加载</td>
                                     <td class="text-center" id="Later">正在加载</td>
                                     <td class="text-center" id="Repaymentmethod">正在加载</td>
                                     <td class="text-center" id="Monthlyrepayment">正在加载</td>
                                    </tr>

                                  </tbody>
                               
                           </tr>
                          </table>


                        </div>
                            

                            <div id="cause" >

                                <textarea disabled="disabled"  name="loan_multiples_requirements" style="resize:none;height: 70px;text-align: center;font-size: 20px; " class="form-control" rows="8">等本等息还款公式：每月还款=贷款金额/贷款期限+贷款金额*后期还贷利息&#10综合月利息（即利息成本）=平台费月利息+后期还贷利息</textarea>
                                
                                    <div style="height: 5px;"></div>

                                <textarea  name="loan_multiples_requirements"   style="resize:none;height: 70px; font-size: 15px; font-weight: bold;" class="form-control" rows="8">${v[0].remark}</textarea>

                                <p style="float: right;">以上资料仅供参考,一切贷款金额以融资机构批款,放款为准,一切解释权归本公司所有</p>

                                <div style="height: 20px;"></div>

                            
                    
                              <label class="col-sm-3 control-label"><span style="color: #ff0000;">*</span>准备资料</label>
                            <div class="" >
                                <textarea  name="loan_multiples_requirements" style="resize:none; font-weight: bold;" class="form-control cause${i} " rows="8">正在加载</textarea>
                                </div>

                            </div>

                            <div style="height: 10px;"></div>
                        
                        <div class="form-group">

                        <div class="col-sm-2 col-sm-offset-5">
                                <button lay-submit lay-filter ="upload" onclick="Printing(this)" data-concentration="${v[0].concentration}" data-versions="${v[0].versions}" style="width: 150px;" class="btn btn-primary btn-block printPage" >打印与导出</button>
                            </div>
                            
                        </div>

                        <div style="height: 50px;"></div>



    
    
                    `
                }
                



                    

               

                    })

                    $('#Template').html(html);


                        $.ajax({

                            type:"post",

                            url:"ajaxScme",

                             data:'order_sn='+result,

                            success:function(data){

                            console.log(data);   

                            var html="";

                            var html1="";

                            var html2="";

                            var daiding="x";

                            $.each(data,function(i,v){

                                // console.log(v);



                             // for (var ia = v.length - 1; ia >= 0; ia--) {
                                for (var ia = 0; ia <= v.length - 1; ia++) {

                                // console.log(v[ia]);

                                if (v[0].type == 1 ||v[0].type == 2) {

                                html+=`
                              
                                 <tr id="html${i}">

                                 <td class="text-center printPage">
                                     <input type="button" class="btn btn-primary updata" style="width: 40px; height:34px; padding:0;" value="编辑">
                                     <button class="btn btn-danger classifyRemove" data-id="${v[ia].id}" onClick="deleteData(this)"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                                     <button class="btn btn-info classifyRemove" data-goodsid="${v[ia].id}" data-versions="${v[ia].versions}" onClick="Move(this)" title="上移"><i class="glyphicon glyphicon-triangle-top"></i></button>
                                     </td>
                                     <td class="text-center" id="Financialcode">${v[ia].name}</td>
                                     <td class="text-center" id="Loanmethod">${v[ia].patterns_lending}</td>
                                     <td class="text-center" id="Lendingtime">${v[ia].time}</td>
                                     <td class="text-center ss" id="Amountofloan">${v[ia].loan_money}万</td>
                                     <td class="text-center ss"  id="Loanterm">${v[ia].deadline}年</td>
                                     <td class="text-center"  id="Comprehensive">${v[ia].Comprehensive}%</td>
                                     <td class="text-center" id="Disposable">${v[ia].platform_fee}%</td>
                                     <td class="text-center " id="Later">${v[ia].interest}%</td>
                                     <td class="text-center " id="Repaymentmethod">${v[ia].mode_repayment}</td>
                                     <td class="text-center" id="Monthlyrepayment">${v[ia].refund}元/月/${v[ia].deadline}年</td>
                                     <td class="text-center ss " style="display:none" id="vid">${v[ia].id}</td>
                                     <td class="text-center printPage" id="credit_investigation">${v[ia].credit_investigation}</td>
                                     <td class="text-center printPage" id="credit">${v[ia].credit}</td>
                                     
                                     
                                     
                                </tr>
                                   
                                `
                                }else if (v[0].type == 3) {

                                html+=`
                              
                            
                                 <tr id="html${i}">
                                   <td class="text-center printPage">
                                     <input type="button" class="btn btn-primary updata" style="width: 40px; height:34px; padding:0;" value="编辑">
                                     <button class="btn btn-danger classifyRemove" data-id="${v[ia].id}" onClick="deleteData(this)"  title="删除商品"><i class="fa fa-trash-o"></i></button>
                                     <button class="btn btn-info classifyRemove" data-goodsid="${v[ia].id}" data-versions="${v[ia].versions}" onClick="Move(this)" title="上移"><i class="glyphicon glyphicon-triangle-top"></i></button>
                                     </td>
                                     <td class="text-center ss" id="Financialcode">${v[ia].name}</td>
                                     <td class="text-center" id="Loanmethod">${v[ia].patterns_lending}</td>
                                     <td class="text-center ss" id="Lendingtime">${v[ia].time}</td>
                                     <td class="text-center ss" id="Amountofloan">${v[ia].loan_money}万</td>
                                     <td class="text-center ss"  id="Loanterm">${v[ia].deadline}年</td>
                                     <td class="text-center ss"  id="Comprehensive">${v[ia].Comprehensive}%</td>
                                     <td class="text-center ss" id="Disposable">${v[ia].platform_fee}%</td>
                                     <td class="text-center ss" id="Later">${v[ia].interest}%</td>
                                     <td class="text-center ss" id="Repaymentmethod">${v[ia].mode_repayment}</td>
                                     <td class="text-center ss" id="Monthlyrepayment">${v[ia].refund}元/月/${v[ia].deadline}年</td>
                                     <td class="text-center ss " style="display:none" id="vid">${v[ia].id}</td>
                                     <td class="text-center ss" id="cost">${v[ia].cost}</td>
                                     <td class="text-center ss" id="remarks">${v[ia].remarks}</td>
                                     
                                     
                                     
                                </tr>
                                   
                                `


                                }else if (v[0].type == 4) {

                                html+=`
                              
                            
                                 <tr id="html${i}">
                                     <td class="text-center printPage">
                                    <button class="btn btn-info classifyRemove" data-versions="${v[ia].versions}" onClick="detailData(this)" title="生成"><i class="fa fa-eye"></i></button>
                                     </td>
                                     <td class="text-center" id="Financialcode">${v[ia].name}</td>
                                     <td class="text-center" id="Loanmethod">${v[ia].patterns_lending}</td>
                                     <td class="text-center" id="Lendingtime">${v[ia].time}</td>
                                     <td class="text-center " id="Amountofloan">${v[ia].loan_money}万</td>
                                     <td class="text-center "  id="Loanterm">${v[ia].deadline}年</td>
                                     <td class="text-center"  id="Comprehensive">${v[ia].Comprehensive}%</td>
                                     <td class="text-center" id="Disposable">${v[ia].platform_fee}%</td>
                                     <td class="text-center " id="Later">${v[ia].interest}%</td>
                                     <td class="text-center " id="Repaymentmethod">${v[ia].mode_repayment}</td>
                                     <td class="text-center" id="Monthlyrepayment">${v[ia].refund}元/月/${v[ia].deadline}年</td>
                                     <td class="text-center ss " style="display:none" id="vid">${v[ia].id}</td>
                                     
                                     
                                </tr>
                                   
                                `


                                }else if (v[0].type == 5) {

                                html+=`
                              
                            
                                 <tr id="html${i}">
                                    <td class="text-center printPage">
                                    <button class="btn btn-info classifyRemove" data-versions="${v[ia].versions}" onClick="detailData(this)" title="生成"><i class="fa fa-eye"></i></button>
                                     </td>
                                     <td class="text-center" id="Financialcode">${v[ia].name}</td>
                                     <td class="text-center" id="Loanmethod">${v[ia].patterns_lending}</td>
                                     <td class="text-center" id="Lendingtime">${v[ia].time}</td>
                                     <td class="text-center " id="Amountofloan">${v[ia].loan_money}万</td>
                                     <td class="text-center "  id="Loanterm">${v[ia].deadline}年</td>
                                     <td class="text-center"  id="Comprehensive">${v[ia].Comprehensive}%</td>
                                     <td class="text-center" id="Disposable">${v[ia].platform_fee}%</td>
                                     <td class="text-center " id="Later">${v[ia].interest}%</td>
                                     <td class="text-center " id="Repaymentmethod">${v[ia].mode_repayment}</td>
                                     <td class="text-center" id="Monthlyrepayment">${v[ia].refund}元/月/${v[ia].deadline}年</td>
                                     <td class="text-center ss " style="display:none" id="vid">${v[ia].id}</td>
                                     
                                     
                                     
                                </tr>
                                   
                                `


                                }

                                // 准备资料
                                 html1+=`${v[ia].datum}\r\n`


                                
                                $('.finaltbody'+i).html(html);
                                
                                $('.cause'+i).html(html1);
                                
                            }
                                html="";
                                html1="";


                              
                                  // 添加一个最后一格占三行的待定
                              if (daiding != i) {
                                html2+=`<td class="text-center" rowspan="${v.length}" id="vid">待定</td>`
                                console.log(i);
                                console.log(daiding);
                                daiding = i ;
                                
                              $('#html'+i).append(html2);
                              }

                              html2="";
                            })


                        $("input:button").click(function() {
                            if($(this).val()=="确定"){
                                var goods={};
                

                                goods["vid"]=$(this).parents("tr").children("#vid").children('input').val();
                                goods["Amountofloan"]=$(this).parents("tr").children("#Amountofloan").children('input').val();
                                goods["Loanterm"]=$(this).parents("tr").children("#Loanterm").children('input').val();

                                // 抵押
                                goods["Financialcode"]=$(this).parents("tr").children("#Financialcode").children('input').val();
                                goods["Lendingtime"]=$(this).parents("tr").children("#Lendingtime").children('input').val();
                                goods["Comprehensive"]=$(this).parents("tr").children("#Comprehensive").children('input').val();
                                goods["Disposable"]=$(this).parents("tr").children("#Disposable").children('input').val();
                                goods["Repaymentmethod"]=$(this).parents("tr").children("#Repaymentmethod").children('input').val();
                                goods["Monthlyrepayment"]=$(this).parents("tr").children("#Monthlyrepayment").children('input').val();
                                goods["cost"]=$(this).parents("tr").children("#cost").children('input').val();
                                goods["remarks"]=$(this).parents("tr").children("#remarks").children('input').val();
                                goods["Later"]=$(this).parents("tr").children("#Later").children('input').val();
                               

                                console.log($(this).parents("tr").children("#vid"));

                                  $.ajax({
                                    type : "post",
                                     url :"ajaxUpdateSc",
                                     data :goods,
                                     success : function(data) {
                                            
                                             layer.msg('修改成功');
                                             F5();
                                        }
                                    });

                            }
                            str = $(this).val()=="编辑"?"确定":"编辑";  
                             $(this).val(str);   // 按钮被点击后，在“编辑”和“确定”之间切换
                             $(this).parent().siblings("td.ss").each(function() {  // 获取当前行的其他单元格
                                   var obj_text = $(this).find("input:text");    // 判断单元格下是否有文本框
                                   if(!obj_text.length)   // 如果没有文本框，则添加文本框使之可以编辑
                                        $(this).html("<input type='text' value='"+$(this).text()+"'>");
                                        else   
                                            $(this).html(obj_text.val());    
                                });

                        });
                             
                            },
                            async:true
                        });
                    



                },

                async:true



            });
          





        


            })

       

            function F5(){


                $.ajax({

                type:"post",

                url:"ajaxScme",

                 data:'order_sn='+result,
                success:function(data){

                    window.location.reload();
                },

                    async:true

                });

            }



         function Move(e){

                var versions =e.dataset.versions;

                var goods =e.dataset.goodsid;


                $.ajax({

                type:"post",

                url:"sort",

                 data:'order_sn='+result+'&versions='+versions+'&goods='+goods,

                success:function(data){

                    window.location.reload();


                },

                    async:true

                });

            }





                // 精简刷新
               function detailData(e){


                var versions =e.dataset.versions;

                 console.log(versions)

                 $.ajax({

                        type:"post",

                        url:"updateSynthesize",

                        data:{
                                'versions':versions,

                                'order_sn':result,
                            
                            },

                        success:function(data){

                        window.location.reload();

                        },

                            async:true

                        });

                    }


                // 删除
               function deleteData(e){

                    var id = e.dataset.id;

                    $.ajax({

                        type:"post",

                        url:"deleteScheme",

                        data:'id='+id,

                        success:function(data){

                            if (data == 1) {

                                layer.msg('删除成功');
                                F5();
                            }

                        },

                        async:true

                    });     
          }

            // 打印跳转
           function Printing(e){

            var concentration = e.dataset.concentration;

            var versions = e.dataset.versions;

            $.ajax({

                type:"post",

                url:"prints",

                data:{
                        'concentration':concentration,

                        'order_sn':result,

                        'versions':versions,

                    
                    },

                success:function(data){

                    window.location.href='{:url('order/dayinprinting')}?order_sn='+result+'&versions='+versions+'&concentration='+concentration;
                },

                async:true

            });     
          }




            // 高亮
             function Highlight(e){
            hlight += e.dataset.classfiyid;
            $(e).parent().parent().addClass("Highlight");
            hlight += "/";
            // console.log(hlight);
            // console.log(scheme);
            // console.log(order_sn);
        }


        //获取地址栏参数，name:参数名称
        function getUrlParms(name){
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)
            return unescape(r[2]);
            return null;
        }

        var result = getUrlParms('order');
        console.log(result);
        // console.log(typeof result);


            // 保存准备资料修改
        function final_Submission(e){

            // var mycars=new Array();

            // var td_length = $("td").length;
            //     //获取tr下的td个数
            // for(var i = 0;i<td_length;i++){

            //     mycars[i]=$("tr").find("td").eq(i).text();

            //        //该tr下的td值
            // }

            //      console.log(mycars)   
            //       console.log(typeof mycars)  

            var readyNum = e.dataset.ready;

            var ready = $('.cause'+readyNum).val();

            var ready1 = $('.ready'+readyNum).val();


            console.log(ready1);

            var versions = e.dataset.versions;

            console.log(versions)

         $.ajax({

                type:"post",

                url:"updateSchemeSubordinate",

                data:{
                        'versions':versions,

                        'order_sn':result,

                        'ready':ready,

                        'ready1':ready1,
                    
                    },

                success:function(data){
                    // 打印
                    // $(".printPage").css("display","none");
                    
                    // window.print(); 
                    // $(".printPage").css("display","");
                    
                    // return false;
                    window.location.reload();


                },

                async:true

            });


        }



                // 导出word
            function exportWord(){

                $(".printPage").css("display","none");
                $("html").wordExport(g_name);
                $(".printPage").css("display","");
          
                return false;
            }



    // 重新挑选
    function Reselection(){

              window.location.href='{:url('order/orderGoodsinfo')}?order_sn='+result+'&versions='+versions;


        }

        </script>
    </body>
</html>
